package com.boot.activemq.consumer.service.impl;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Service;

@Service("activeMQConsumer")
public class ActiveMQConsumer {

    /**
     *
     * 双向队列
     * 监听city.queue队列
     * 然后投递到city.queue.success
     * @param text
     * @return
     */
    @JmsListener(destination = "city.queue")
    @SendTo("city.queue.success")
    public String receiveQueue(String text){

        System.out.println(text);

        return "消费成功"+text;
    }


    @JmsListener(destination = "city.topic")
    public void receiveTopic(String text){

        System.out.println(text);
    }


}
